package service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dao.AggrStatVisitDao;
import dao.BlackListDao;
import dao.impl.AggrStatVisitDaoImpl;
import dao.impl.BlackListDaoImpl;
import domain.AggrStat;
import domain.BlackList;

import java.util.List;

public class AggrStatVisitService {
    String valueAsString = null;
    private AggrStatVisitDao contacts = new AggrStatVisitDaoImpl();
    public String ToJson() {
        List<AggrStat> list = contacts.SelectVisit();
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            valueAsString = objectMapper.writeValueAsString(list);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return valueAsString;
    }
}
